﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Client.aspx.cs" Inherits="Client" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        Барај податоци за личноста (не мора да се целосно комплетни):
        <table style="width:100%;">
            <tr>
                <td class="style1">
                    Име:</td>
                <td>
                    <asp:TextBox ID="txtIme" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Презиме:</td>
                <td>
                    <asp:TextBox ID="txtPrezime" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    Матичен број:</td>
                <td>
                    <asp:TextBox ID="txtMaticenBroj" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Button ID="txtListaj" runat="server" onclick="txtListaj_Click" 
                        Text="Листај" />
                </td>
                <td>
                    <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True" Height="107px" 
                        Width="265px" onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>
                </td>
            </tr>
            <tr>
                <td class="style1" colspan="2">
                    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ssn" 
                        DataSourceID="AccessDataSource1" InsertItemPosition="LastItem" 
                        oniteminserted="ListView1_ItemInserted" Visible="False">
                        <AlternatingItemTemplate>
                            <tr style="background-color:#FFF8DC;">
                                <td>
                                    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                                        Text="Delete" />
                                    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                                </td>
                                <td>
                                    <asp:Label ID="ssnLabel" runat="server" Text='<%# Eval("ssn") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="c_ratingLabel" runat="server" Text='<%# Eval("c_rating") %>' />
                                </td>
                            </tr>
                        </AlternatingItemTemplate>
                        <EditItemTemplate>
                            <tr style="background-color:#008A8C;color: #FFFFFF;">
                                <td>
                                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                                        Text="Update" />
                                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                        Text="Cancel" />
                                </td>
                                <td>
                                    <asp:Label ID="ssnLabel1" runat="server" Text='<%# Eval("ssn") %>' />
                                </td>
                                <td>
                                    <asp:TextBox ID="c_ratingTextBox" runat="server" 
                                        Text='<%# Bind("c_rating") %>' />
                                </td>
                            </tr>
                        </EditItemTemplate>
                        <EmptyDataTemplate>
                            <table runat="server" 
                                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                                <tr>
                                    <td>
                                        No data was returned.</td>
                                </tr>
                            </table>
                        </EmptyDataTemplate>
                        <InsertItemTemplate>
                            <tr style="">
                                <td>
                                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                                        Text="Insert" />
                                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                        Text="Clear" />
                                </td>
                                <td>
                                    <asp:Label ID="ssnTextBox" runat="server" Text='<%# Bind("ssn") %>' />
                                </td>
                                <td>
                                    <asp:TextBox ID="c_ratingTextBox" runat="server" 
                                        Text='<%# Bind("c_rating") %>' />
                                </td>
                            </tr>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <tr style="background-color:#DCDCDC;color: #000000;">
                                <td>
                                    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                                        Text="Delete" />
                                    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                                </td>
                                <td>
                                    <asp:Label ID="ssnLabel" runat="server" Text='<%# Eval("ssn") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="c_ratingLabel" runat="server" Text='<%# Eval("c_rating") %>' />
                                </td>
                            </tr>
                        </ItemTemplate>
                        <LayoutTemplate>
                            <table runat="server">
                                <tr runat="server">
                                    <td runat="server">
                                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                            <tr runat="server" style="background-color:#DCDCDC;color: #000000;">
                                                <th runat="server">
                                                </th>
                                                <th runat="server">
                                                    ssn</th>
                                                <th runat="server">
                                                    c_rating</th>
                                            </tr>
                                            <tr ID="itemPlaceholder" runat="server">
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr runat="server">
                                    <td runat="server" 
                                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                                        <asp:DataPager ID="DataPager1" runat="server">
                                            <Fields>
                                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                                    ShowLastPageButton="True" />
                                            </Fields>
                                        </asp:DataPager>
                                    </td>
                                </tr>
                            </table>
                        </LayoutTemplate>
                        <SelectedItemTemplate>
                            <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                                <td>
                                    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" 
                                        Text="Delete" />
                                    <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                                </td>
                                <td>
                                    <asp:Label ID="ssnLabel" runat="server" Text='<%# Eval("ssn") %>' />
                                </td>
                                <td>
                                    <asp:Label ID="c_ratingLabel" runat="server" Text='<%# Eval("c_rating") %>' />
                                </td>
                            </tr>
                        </SelectedItemTemplate>
                    </asp:ListView>
                    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                        DataFile="~/App_Data/ForestryEnterprise.mdb" 
                        DeleteCommand="DELETE FROM [Client] WHERE [ssn] = ?" 
                        InsertCommand="INSERT INTO [Client] ([ssn], [c_rating]) VALUES (?, ?)" 
                        OldValuesParameterFormatString="original_{0}" 
                        SelectCommand="SELECT * FROM [Client] WHERE ([ssn] = ?)" 
                        UpdateCommand="UPDATE [Client] SET [c_rating] = ? WHERE [ssn] = ?">
                        <DeleteParameters>
                            <asp:ControlParameter ControlID="ListBox1" Name="ssn" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:Parameter Name="c_rating" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:ControlParameter ControlID="ListBox1" Name="ssn" 
                                PropertyName="SelectedValue" Type="Int32" />
                            <asp:Parameter Name="c_rating" Type="Int32" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="ListBox1" Name="ssn" 
                                PropertyName="SelectedValue" Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                        <asp:ControlParameter ControlID="ListBox1" Name="ssn" PropertyName="SelectedValue" Type="Int32" />
                            <asp:Parameter Name="c_rating" Type="Int32" />
                        </UpdateParameters>
                    </asp:AccessDataSource>
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
            </table>
    
    </div>
    </form>
</body>
</html>
